<?php
/* @var $this OrderController */
/* @var $model Order */

$this->breadcrumbs=array(
	'Orders'=>array('index'),
);

?>


<div class="row">
    <div class="page-header">
        <h1>Содержание заказа</h1>
    </div>
</div>
<div class="row">
    <h4>Данные клиента</h4>
</div>
<div class="row">
    <table class="table table-striped table-bordered">
        <tr>
            <th>Имя</th>
            <th>Email</th>
            <th>Телефон</th>
            <th>Адрес</th>
            <th>Комментарий</th>
        </tr>
        <tr>
            <td>
                <?php echo $model->username; ?>
            </td>
            <td>
                <?php echo $model->email; ?>
            </td>
            <td>
                <?php echo $model->phone; ?>
            </td>
            <td>
                <?php echo $model->address; ?>
            </td>
            <td>
                <?php echo $model->comment; ?>
            </td>
        </tr>
    </table>
</div>
<div class="row">
    <h4>Информация по заказу</h4>
</div>
<div class="row">
    <table class="table table-bordered">
        <thead>
        <tr>
            <th>Название</th>
            <th>Цена</th>
            <th>Количество</th>
            <th>Общая стоимость</th>
        </tr>
        </thead>
        <tbody>
        <?php $total_price = 0; ?>
        <?php foreach($model->productRel as $productRel):?>
            <tr>
                <td><?php echo CHtml::link($productRel->product->title, $this->createUrl('/obnovit/tovar', array('id'=>$productRel->product->id))); ?></td>
                <td><?php echo $productRel->product->price; ?></td>
                <td><?php echo $productRel->count?></td>
                <td><?php $total_price += ($productRel->count)*($productRel->product->price); echo ($productRel->count)*($productRel->product->price); ?></td>
            </tr>
        <?php endforeach; ?>
        <tr>
            <td>Итого: </td>
            <td></td>
            <td></td>
            <td><b><?php echo $total_price; ?></b></td>
        </tr>
        </tbody>
    </table>
</div>



